The Algebraic Foundation: Lines and Affine Sets
To navigate a multi-dimensional optimization landscape, we must define how to move between two points $x_1$ and $x_2$. A mathematical line is the set of all points $y$ satisfying:
$$y = \theta x_1 + (1 - \theta)x_2$$
Equivalently, we can view this as starting at $x_2$ and moving in the direction $(x_1 - x_2)$ scaled by $\theta$: $y = x_2 + \theta(x_1 - x_2)$. When $\theta$ ranges over all real numbers $\mathbb{R}$, we generate an affine set. A crucial property to remember: Any line is affine. If it passes through zero, it is a subspace, hence also a convex cone.
A line segment is the restriction where $0 \le \theta \le 1$. Unlike the infinite line, a line segment is convex, but not affine (unless it reduces to a point). It represents the collection of all "weighted averages" or blends between two endpoints.
A ray, which has the form $\{x_0 + \theta v \mid \theta \ge 0\}$, where $v \neq 0$, is also convex, but not affine. Rays are the foundational building blocks for cones in optimization theory.
The Convexity Litmus Test
We define a set $C$ as convex if the line segment connecting any two points in the set lies entirely within the set. This simple requirement—inclusion of the "bridge"—is what makes optimization problems tractable or insurmountable.
Example: Portfolio Optimization
In finance, suppose $x_1$ represents a portfolio of 100% stocks and $x_2$ is 100% bonds. The line segment represents all possible weighted blends. For instance, a 60/40 split occurs at $\theta = 0.6$. If the set of "allowable portfolios" is convex, then any mixture of two valid portfolios is guaranteed to be valid—a property that simplifies risk assessment immensely.